package main.java.FSMDE.validation.rules;

import java.util.ArrayList;
import java.util.List;

import main.java.FSMDE.models.Diagram;
import main.java.FSMDE.models.Interface;
import main.java.FSMDE.models.InterfaceGraphType;
import main.java.FSMDE.validation.IValidationEntry;
import main.java.FSMDE.validation.rules.IRulesValidator;


public class DiagramEndInterfaceValidator implements IRulesValidator {

	@Override
	public Iterable<IValidationEntry> validate(Diagram diagram) {
		List<IValidationEntry> entries = new ArrayList<IValidationEntry>();
		int end = 0;
		for (Interface inface : diagram.getInterfaces()) {
			if(inface.getGraphType().equals(InterfaceGraphType.Ending_interface) ){
				end++;
			}
				
		}
		if(end == 0 ) entries.add(new DiagramEndInterfaceValidationEntry(diagram));
		return entries;
	}

}
